<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery validation plug-in - main demo</title>
<link rel="stylesheet" href="../js/validate/css/screen.css" />
<script src="../js/jquery-1.7.2.js"></script>
<script src="../js/validate/jquery.validate.min.js"></script>
<style type="text/css">
.error { color:red; }
</style>
<script>
$(document).ready(function() {
	// validate the comment form when it is submitted
	$("#form1").validate({
		rules: {
			name: {
				required: true,
				minlength: 2
			},
			email: {
				required: true,
				email: true
			},
			url: {
				required: true,
				url: true
			}
		},
		messages: {
			name:{
				required:"name is not null",
				minlength:"min length 2"
			},
			email: {
				required: 'Enter this!',
				email:"email error"
			},
			url: {
				required: 'Enter this!',
				url:"url error"
			}
		}
	});
});	
</script>


</head>
<body>
	<form  id="form1" method="get" action="">
		<p>
			<label for="name">Name (required, at least 2 characters)</label>
			<!-- minlength 最小长度 maxlength  -->
			<input id="name" name="name" />
		</p>
		<p>
			<label for="email">E-Mail (required)</label>
			<input id="email" name="email" />
		</p>
		<p>
			<label for="url">URL (optional)</label>
			<input id="url" name="url" />
		</p>
		<p>
			<input class="submit" type="submit" value="Submit"/>
		</p>
</form>
</body>
</html>
